﻿@model IEnumerable<SimpleTaskManager.Domain.Entities.Project>

@{
    Layout = null;
}

<table class="tablesorter" id="projectTable">
<thead>
<tr>
    <th>Name</th>
    <th>Deadline</th>
    <th>Leader</th>
    <th>Group</th>
    <th>Status</th>
</tr>
</thead>
<tbody>
@foreach(var p in Model)
{
    var task = p.MainTask;
    <tr>
        <td>@Html.ActionLink(task.Name, "Details", "Task", new { id = task.TaskID }, null)</td>
        <td>@task.EndDate.ToShortDateString()</td>
        <td>@(task.Leader.LastName + ", " + task.Leader.FirstName)</td>
        <td>@(task.Group.Count.ToString() + "/" + task.GroupSize.ToString())</td>
        <td>@task.Status</td>
    </tr>
}
</tbody>
</table>
@if(ViewBag.CanCreateProject){
        <div class="list_button">@Html.ActionLink("Add new project", "Create", "Task", new { parentId = -1}, null)</div>
    }

<script type="text/javascript">
    $(document).ready(function () {
        $("#projectTable").dataTable({ bJQueryUI: true, sPaginationType: "full_numbers" });
    }
);
</script>